package com.zoweunion.mechanic.config.application;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.*;

@Configuration
public class ExecutorsCachedThreadPool {

    @Bean("cachedThreadPool")
    public ExecutorService cachedThreadPool() {
        return new ThreadPoolExecutor(4, Integer.MAX_VALUE,
                120L, TimeUnit.SECONDS,
                new SynchronousQueue<>());
    }
}
